package com.book.service.impl;

import com.book.mapper.ChapterContentDao;
import com.book.pojo.Chapter;
import com.book.mapper.ChapterDao;
import com.book.service.ChapterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
<<<<<<< HEAD
 * @author cxy
 * @since 2023-10-11 23:21:45
=======
 * @author cc
 * @since 2023-10-11 22:05:52
>>>>>>> a45ef284ff029011b55ef4d830c2b996023ef30c
 */
@Service
public class ChapterServiceImpl extends ServiceImpl<ChapterDao, Chapter> implements ChapterService {

    @Autowired
    private ChapterDao chapterDao;
    @Autowired
    private ChapterContentDao chapterContentDao;

    @Override
    public void addChapter(Chapter chapter) {
        chapterDao.insert(chapter);
    }

    @Override
    public void updateChapter(Chapter chapter) {
        chapterDao.updateById(chapter);
    }

    @Override
    public void deleteChapter(Long id) {
        chapterDao.deleteById(id);
        chapterContentDao.deleteById(id);
    }
}
